﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EfDomain.Entities
{
    /*一对多映射*/

    // Principal (parent)
    public class Author : BaseEntity
    {
        public ICollection<Book>? Books { get; } = new List<Book>(); // Collection navigation containing dependents
    }

    // Dependent (child)
    public class Book : BaseEntity
    {
        public Author Author { get; set; } // Optional reference navigation to principal
    }

    /// <summary>
    /// 单表1对多
    /// </summary>
    public class Employee:BaseEntity
    {
        public int? ManagerId { get; set; } // Optional foreign key property
        public Employee? Manager { get; set; } // Optional reference navigation to principal
        public ICollection<Employee> Reports { get; } = new List<Employee>(); // Collection navigation containing dependents
    }
}
